<?php
namespace app\admin\model;
use think\Model;
use think\Log;

class Cuser extends Model
{
  protected $insert  = ['create_time','login_count','login_ip'];

    public function selectList()
    {
        $data = Db::name('cuser')->select();
    }


    public function userInfo()
    {
        return $this->hasOne('userInfo', 'uid', 'id');
    }

    public function userGroup()
    {
        return $this->hasMany('authGroupAccess', 'uid', 'id');
    }

    protected function setPasswordAttr($value)
    {
        return md5($value);
    }
    protected function setLogincountAttr()
    {
        return '0';
    }

    protected function setCreateTimeAttr()
    {
        return time();
    }
    protected function setLoginIpAttr()
    {
        return request()->ip();
    }
    protected function setStauts($value,$data)
    {
        return [$data['status0']=>'正常',$data['stauts1']=>'账号冻结'];
    }


    public function getCreateTimeTurnAttr($value, $data)
    {
        return date('Y-m-d H:i:s', $data['create_time']);
    }



}